<ul id="menuList" class="nav navbar-nav">
    #for (menu : menus)
        #if(menu.pid<=1)
            #if(not_empty(menu.children))
                <li>
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button"
                       id="dropdownMenu-${menu.id}"
                    >
                        ${menu.name} <span class="caret"></span>
                    </a>
                    #if(not_empty(menu.children))
                        <ul class="dropdown-menu" aria-labelledby="dropdownMenu-${menu.id}">
                            #for(subMenu : menu.children)
                                <li>
                                    <a href="${subMenu.url}">
                                        ${subMenu.name}
                                    </a>
                                </li>
                            #end
                        </ul>
                    #end
                </li>
            #end

            #if(!not_empty(menu.children))
                <li>
                    <a href="${menu.url}">${menu.name}</a>
                </li>
            #end
        #end
    #end
</ul>